home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / sviluppo / svilupp2 / strngs18.lha / strings.readme
Text File  |  1996-12-17  |  15KB  |  533 lines

  1.  
  2. Program:  strings.library (E example source included)
  3. Version:  v1.8
  4. Uploader: Kåre Johansen (kaarej@barentsnett.no)
  5. Author:   Kåre Johansen (kaarej@barentsnett.no)
  6. Short:    Strings Library for programmers...
  7. Type:     Dev/Misc
  8.  
  9.  
  10.                                  Prologue
  11.                                  --------
  12.  
  13.   Welcome to another release of strings.library.. This library was
  14.   meant for dos/shell purposes only when I first released v1.0.. 
  15.   This library can be used to everything.. I use this library in
  16.   doors coding, and other utilities that needs these kinds of
  17.   commands. I'm sure these commands will come in hand for you
  18.   aswell.. I have put alot of time within this library, and I
  19.   would apreachiate if anyone sent me bugs reports, features
  20.   what ever you want to see in strings.library.. My E-MAIL
  21.   can be found at the end of this documentation...
  22.  
  23.                               What is this!?
  24.                               --------------
  25.  
  26.   Well.. This library is based on a MODULE I made for AMIGA E for some
  27.   time back.. This lib is a tool based library, at this very moment
  28.   I have just made a few commands.. But, there will be more in the
  29.   future.. :) (Read the syntax for more info)...
  30.  
  31.  
  32.                            Arexx Kinda Commands
  33.                            --------------------
  34.  
  35.   StrWord()    - Converted cmd from Arexx called : Word      ()
  36.   Str2Number() - Converted cmd from Arexx called : C2D       ()
  37.   StrReplace() - Converted cmd from Arexx called : Translate ()
  38.   StrCopies()  - Converted cmd from Arexx called : Copies    ()
  39.   Fexists()    - Converted cmd from Arexx called : Exists    ()
  40.  
  41.                           What about the syntax!?
  42.                           -----------------------
  43.  
  44.   Here are a list of the supported commands..
  45.  
  46.   strings.library/StrCentre()               v1.0 bugFixed in v1.7
  47.   strings.library/StrWord()                 v1.0 bugFixed in v1.7
  48.   strings.library/StrRight()                v1.0 bugFixed in v1.7
  49.   strings.library/Str2Number()              v1.0 bugFixed in v1.7
  50.   strings.library/StrReplace()              v1.1 bugFixed in v1.7
  51.   strings.library/StrCopies()               v1.2 bugFixed in v1.7
  52.   strings.library/Version()                 v1.2
  53.   strings.library/Fexists()                 v1.3 Improved in v1.5
  54.   strings.library/PowNum()                  v1.4
  55.   strings.library/Asc2Num()                 v1.4
  56.   strings.library/Num2Bin()                 v1.5
  57.   strings.library/Str2Upper()               v1.6 bugFixed in v1.7
  58.   strings.library/Str2Lower()               v1.6 bugFixed in v1.7
  59.   strings.library/Num2Dec()                 v1.7
  60.   strings.library/VersionDate()             v1.7
  61.   strings.library/GetTime()                 v1.8 TIME/DATE command
  62.   strings.library/GetTicks()                v1.8 TIME/DATE command
  63.   strings.library/Tick2Time()               v1.8 TIME/DATE command
  64.   strings.library/SetTimer()                v1.8 TIME/DATE command
  65.   strings.library/GetTimer()                v1.8 TIME/DATE command
  66.  
  67. StrCentre() strings.library/StrCentre()
  68.  
  69.     NAME
  70.     StrCentre() -- Will center a text in SHELL/CLI
  71.  
  72.     SYNOPSIS
  73.     res:=StrCentre(text,length)
  74.  
  75.     FUNCTION
  76.     - This command will center a text in your SHELL/CLI window..
  77.  
  78.     INPUT/OUTPUTS
  79.     res    - Result
  80.     text   - The text you want to center on the screen
  81.     length - The length of your screen.. (Default 79) THIS -> WAY :)
  82.  
  83. StrWord() strings.library/StrWord()
  84.  
  85.     NAME
  86.     StrWord() -- Will locate a word in a text specified by you
  87.  
  88.     SYNOPSIS
  89.     res:=StrWord(text,word)
  90.  
  91.     FUNCTION
  92.     - This command will get the word you want to collect from a text
  93.       e.g : StrWord('Hello, this is a test',3) would be:
  94.                 IS
  95.  
  96.     INPUT/OUTPUTS
  97.     res  - Result
  98.     text - The text you want to get a word from
  99.     word - The word number you want to get
  100.  
  101.     BUGS
  102.     Somehow there has been a bug all the time when using this command.
  103.     The result sometimes produced more than ONE word, fixed in v1.5
  104.  
  105. StrRight() strings.library/StrRight()
  106.  
  107.     NAME
  108.     StrRight() -- Will write the text to the right in your SHELL window.
  109.  
  110.     SYNOPSIS
  111.     res:=StrRight(text,pos)
  112.  
  113.     FUNCTION
  114.     This command will print a text to the right of your SHELL/CLI
  115.     window..
  116.  
  117.     INPUT/OUTPUTS
  118.     res  - Result
  119.     text - The text you want to print to the right
  120.     pos  - The position on your screen (Default: 79)
  121.  
  122. Str2Number() strings.library/Str2Number()
  123.  
  124.     NAME
  125.     Str2Number() -- This command will convert a string to a number
  126.  
  127.     SYNOPSIS
  128.     res:=Str2Number(text)
  129.  
  130.     FUNCTION
  131.     This command will convert a text of 4 characters maximum to a
  132.     number.. E.g.:
  133.  
  134.     STRING        NUMERIC:
  135.     DOS        4476755
  136.     TEST        1413829460
  137.     JOHN        1246709838
  138.  
  139.     INPUT/OUTPUTS
  140.     res  - Result
  141.     text - The text you want to convert to a number...
  142.  
  143. StrReplace() strings.library/StrReplace()
  144.  
  145.     NAME
  146.     StrReplace() -- Will replace one character with another one
  147.  
  148.     SYNOPSIS
  149.     str:=StrReplace(text,repchar,repwith)
  150.  
  151.     FUNCTION
  152.     - This command will replace/or translate a text into the
  153.       character you want to replace in a text
  154.     e.g:
  155.  
  156.     str:=StrReplace('testing_a_little_bit','_',' ')
  157.  
  158.     Will output:
  159.  
  160.     testing a little bit
  161.  
  162.     INPUT/OUTPUTS
  163.     str     - Result
  164.     text    - The text you want to replace from
  165.     repchar - The letter you want to remove
  166.     repwith - The letter you want to insert instead of repchar
  167.  
  168.  
  169. StrCopies() strings.library/StrCopies()
  170.  
  171.     NAME
  172.     StrCopies() -- Will copy a char number of times to a string..
  173.  
  174.     SYNOPSIS
  175.     str:=StrCopies(copychar,times)
  176.  
  177.     FUNCTION
  178.     - This command will copy a char to a string x number of times..
  179.     e.g:
  180.  
  181.     str:=StrCopies('DOC',6)
  182.  
  183.     Will output:
  184.  
  185.     DOCDOCDOCDOCDOCDOC
  186.  
  187.     INPUT/OUTPUTS
  188.     str     - Result
  189.     copychar- The char you want to copy to the string
  190.     times   - How many times this you want the char to be copied
  191.  
  192. Version() strings.library/Version()
  193.  
  194.     Version() -- This will result version and revision version of SLIB
  195.                      This command should have been created long time ago,
  196.                      sorry about this...
  197.  
  198.     SYNOPSIS
  199.     version,revision=Version()
  200.  
  201.     FUNCTION
  202.  
  203.     OUTPUT
  204.     version  - The version number of strings.library
  205.     revision - The revision number of strings.library
  206.  
  207. Fexists() strings.library/Fexists()
  208.  
  209.     Fexists() -- This command will result FALSE or TRUE if a file
  210.                      exists or not..
  211.  
  212.     SYNOPSIS
  213.     result=Fexists()
  214.  
  215.     FUNCTION
  216.     This command will result back TRUE OR FALSE (-1/0), depending
  217.     if the file exists or not.
  218.  
  219.     result:=Fexists(filename)
  220.  
  221.     INPUT/OUTPUT
  222.     filename - Will be the name of the file you are checking for
  223.     result   - Result will be -1 or 0
  224.  
  225. PowNum() strings.library/PowNum()
  226.  
  227.     PowNum() -- This command will elevate 2 numbers..
  228.  
  229.     SYNOPSIS
  230.     result=PowNum(num1,num2)
  231.  
  232.     FUNCTION
  233.     This command will elevate num1 and num2.. Lets say I want to know
  234.     the square of num1 and num2 (e.g : 4^5 = 1024) then you can do
  235.     like this:
  236.  
  237.     result:=PowNum(4,5)
  238.  
  239.     In math it will look like this: 4*4*4*4*4 = 1024 
  240.  
  241.     INPUT/OUTPUT
  242.     Result   - Result
  243.     num1     - Will be the number you want to elevate with
  244.         num2     - The number of times you want to multiply num1
  245.         result   - Will be the sum of the calculation
  246.  
  247. Asc2Num() strings.library/Asc2Num()
  248.  
  249.     Asc2Num() -- This command will produce the ascii value of a char
  250.  
  251.     SYNOPSIS
  252.     result=Asc2Num(char)
  253.  
  254.     FUNCTION
  255.     This command will produce the ascii value of a char, lets say I
  256.         want to know what ascii value the letter/char A are.. ONLY one (1)
  257.     character is allowed... 
  258.  
  259.     result:=Asc2Num('A')
  260.  
  261.     The result will be: 65
  262.  
  263.     INPUT/OUTPUT
  264.     result   - Result
  265.     char     - This will be the character you want to convert to a number
  266.  
  267. Num2Bin() strings.library/Num2Bin()
  268.  
  269.     Num2Bin() -- This will convert a number value into a binary number
  270.  
  271.     SYNOPSIS
  272.     result=Num2Bin(number)
  273.  
  274.     FUNCTION
  275.     This command will convert a DEC number to binary
  276.  
  277.     result:=Num2Bin(173)
  278.  
  279.     The result will be: 10101101
  280.  
  281.     INPUT/OUTPUT
  282.     result   - Result
  283.     Number   - The number you want to convert to binary
  284.  
  285.  
  286. Str2Upper() strings.library/Str2Upper()
  287.  
  288.     Str2Upper() -- This will convert a string to uppercase
  289.  
  290.     SYNOPSIS
  291.     result=Str2Upper(text)
  292.  
  293.     FUNCTION
  294.     This command will convert a text to uppercased, this command will
  295.         also handle the norwegian letters: Æ, Ø and Å...
  296.  
  297.     result:=Str2Upper('aBCøæÅ')
  298.  
  299.     The result will be: ABCØÆÅ
  300.  
  301.     INPUT/OUTPUT
  302.     result   - Result
  303.     text     - The text you want to convert to uppercase..
  304.  
  305.  
  306. Str2Lower() strings.library/Str2Lower()
  307.  
  308.     Str2Lower() -- This will convert a string to lowercase
  309.  
  310.     SYNOPSIS
  311.     result=Str2Lower(text)
  312.  
  313.     FUNCTION
  314.     This command will convert a text to lowercase, this command will
  315.         also handle the norwegian letters: Æ, Ø and Å...
  316.  
  317.     result:=Str2Lower('aBCøæÅ')
  318.  
  319.     The result will be: abcøæå
  320.  
  321.     INPUT/OUTPUT
  322.     result   - Result
  323.     text     - The text you want to convert to lowercase..
  324.  
  325. Num2Dec() strings.library/Num2Dec()
  326.  
  327.     Num2Dec() -- This will convert a string number to a fixed number
  328.  
  329.     SYNOPSIS
  330.     result=Num2Dec(number,fix)
  331.  
  332.     FUNCTION
  333.     This command will convert a number to a fixed number, e.g:
  334.  
  335.     result:=Num2Dec(1000000,3)
  336.     result:=Num2Dec(100000,3)
  337.     result:=Num2Dec(100000,2)
  338.  
  339.     The result will be: 1.000.000
  340.     The result will be: 100.000
  341.     The result will be: 10.00.00
  342.  
  343.     INPUT/OUTPUT
  344.     result  - Result
  345.         number  - The number you want to be fixed
  346.                   in Amiga E : StringF(number,'\s
  347.     fix     - How many digits before a comma (.) (from the right)
  348.  
  349. VersionDate() strings.library/VersionDate()
  350.  
  351.     Version() -- This will result the date of creation of library
  352.  
  353.     SYNOPSIS
  354.     date=VersionDate()
  355.  
  356.     FUNCTION
  357.  
  358.     OUTPUT
  359.     Date     - Date (time) of creation of strings.library (when compiled)
  360.  
  361.  
  362. GetTime() strings.library/GetTime()
  363.  
  364.     GetTime() -- This will result the day, date, time as an argument
  365.  
  366.     SYNOPSIS
  367.     result=GetTime()
  368.  
  369.     FUNCTION
  370.         This function will get the current day, date and time as an argument.
  371.         To separate them, use StrWord() to get them! :)
  372.  
  373.     OUTPUT
  374.     result    - day, date and time (eg: Monday 01-Jan-1997 00:01:30)
  375.  
  376.  
  377. GetTicks() strings.library/GetTicks()
  378.  
  379.     GetTicks() -- This will result the day, date, time as an argument
  380.  
  381.     SYNOPSIS
  382.     result=GetTicks()
  383.  
  384.     FUNCTION
  385.         This function will get the current day, date and time as an argument,
  386.         but as dayticks, dateticks and ticks.. To separate them,
  387.         use StrWord() to get them! :)
  388.  
  389.     OUTPUT
  390.     result    - day, date and time (eg: 6925 698 859)
  391.  
  392. Tick2Time() strings.library/GetTicks()
  393.  
  394.     Tick2Time() -- This will result the day, date, time as an argument
  395.  
  396.     SYNOPSIS
  397.     result=GetTicks(dayticks, dateticks, timeticks)
  398.  
  399.     FUNCTION
  400.         This function will get the current day, date and time as an argument,
  401.     using dayticks, dateticks and timeticks values, useful for BBS
  402.         coders when converting "timestamp" to a date.. To separate them
  403.         use StrWord() to get them! :)
  404.  
  405.     INPUT
  406.         dayticks  - Timestamp Dayticks (see output)
  407.     dateticks - Timestamp Dateticks (see output)
  408.         timeticks - Timestamp Timeticks (see output)
  409.  
  410.     OUTPUT
  411.     result    - day, date and time as a string argument..
  412.  
  413.                          Ticks             Converted Ticks
  414.                     ---------------------------------------------
  415.                      6925 698 859     Tuesday 17-Dec-96 11:38:17
  416.  
  417. SetTimer() strings.library/SetTimer()
  418.  
  419.     SetTimer() -- This command will reset or set a timer for you
  420.  
  421.     SYNOPSIS
  422.     SetTimer(mins,secs)
  423.  
  424.     FUNCTION
  425.     This command will calculate a timer/counter that will count from
  426.         the values you enter in the parameters..
  427.  
  428.         e.g: SetTimer(59,30) will set the timer to: 00:59:30
  429.  
  430.     INPUT
  431.     mins   - How many minutes/hours the timer should be set to..
  432.         secs   - How many seconds/minutes the timer should be set to..
  433.  
  434. GetTimer() strings.library/GetTimer()
  435.  
  436.     GetTimer() -- This command will get the timer you set with
  437.                       SetTimer.. If you don't set anything with the
  438.                       SetTimer(), the GetTimer() will use the real
  439.                       timer (your clock :))... 
  440.  
  441.     SYNOPSIS
  442.     result:=GetTimer()
  443.  
  444.     FUNCTION
  445.     
  446.     This function will calculate the new timer as the new result.
  447.  
  448.     OUTPUT
  449.     result  - The new timer result (e.g: 00:00:00)
  450.  
  451.  
  452.  
  453.                              Bugs/news/Hisory
  454.                              ----------------
  455.   v1.8
  456.   - Added new command SetTimer()
  457.   - Added new command GetTimer()
  458.   The following 3 date/time commands results a 3 args string, to get them
  459.   use StrWord() or FindArg() from DOS.LIBRARY...
  460.  
  461.   - Added new command GetTime()
  462.   - Added new command GetTicks()
  463.   - Added new command Tick2Time()
  464.  
  465.   v1.7
  466.   - Rewrote StrWord() again !... (Gosj, I'm getting tired of this)..
  467.   - Added new command Num2Dec()
  468.   - Fixed a major bug in all Str commands!!... If used more than one (1)
  469.     time after each other, the value would be the same as the last one, eg
  470.  
  471.     word:='Hello again'
  472.     Printf('\s (word 1) \s (word 2)\n',StrWord(word,1),StrWord(word,2))
  473.  
  474.     Results : Word 1 = "again"   Word 2 = "again"
  475.  
  476.     All commands has been prefixed..
  477.  
  478.   v1.6
  479.   - Added new command Str2Upper()
  480.   - Added new command Str2Lower()
  481.  
  482.   - Internal release
  483.  
  484.   v1.5
  485.   - StrWord() did something weird with the "in variable" if there was
  486.     more than 1 StrWord(); Eg
  487.  
  488.     --------------
  489.     buff:='Hello my friend'
  490.  
  491.     var1:=StrWord(buff,1)
  492.     var2:=StrWord(buff,2)
  493.     var3:=StrWord(buff,3)
  494.  
  495.     The var1, var2 and var3 contained ALL the same value -> FRIEND..
  496.     --------------
  497.     - Rewrote some of the StrWord() routine once again
  498.  
  499.   v1.4
  500.   - Found a bug in the StrWord() command, this command added more
  501.     than one word to the result string, fixed..
  502.   - Optimized the Fexists() command. When using this, Fexists will
  503.     no longer open a requester when a path doesn't exist. Rewrote
  504.     the return result codes:
  505.     0 = File not found
  506.     1 = File exists
  507.     2 = Device not mounted
  508.   - Optimized/fixed the StrReplace() command, now you can replace
  509.     more than ONE char in a text... Replace/insert words/sentences
  510.     or a single char...
  511.  
  512.  
  513. -------------------------------------------------------------------------------
  514.                             Programmers Notice!
  515.                             -------------------
  516.  
  517.   Libraries created by E should be opened/closed by any one task EXACTLY
  518.   ONCE, not more, not less (this shouldn't pose any problems though).
  519.   Strange things WILL happen if you don't obey this rule.
  520.  
  521. ------------------------------------------------------------------------------
  522.                              For contacting me
  523.                              -----------------
  524.  
  525.                        E-MAIL: kaarej@barentsnett.no
  526.  
  527.                                     OR
  528.  
  529.                      BBS: Key Stroke BBS +47-7847-1042
  530. ------------------------------------------------------------------------------
  531.  
  532.                That should be all... Happy programming.. :)
  533.